import { createRouter, createWebHistory } from 'vue-router'

//导入组件
import Main from "@/views/Admin/Main.vue";
import Home from "@/views/Admin/Home.vue";
import Complaint from "@/views/Admin/Complaint.vue";
import Emergency from '@/views/Admin/Emergency.vue';
import Hotel from '@/views/Admin/Hotel.vue';
import Room from '@/views/Admin/Room.vue';
import Login from "@/views/Login.vue";
import AdminResetPwd from "@/views/Admin/AdminResetPwd.vue";

const routes = [
    {
        path: '/',
        redirect: '/home' // 默认重定向到首页
    },
    {
      path: '/login',
      component: Login
    },
    {
        path: '/admin',
        component: Main,
        children: [
            {
                path: '/home',
                component: Home
            },
            {
                path: '/complaint',
                component: Complaint
            },
            {
                path: '/emergency',
                component: Emergency
            },
            {
                path: '/hotel',
                component: Hotel
            },
            {
                path: '/room',
                component: Room
            },
            {
                path: '/resetPwd',
                component: AdminResetPwd
            }
        ]
    }
]

const router = createRouter({
    history: createWebHistory(),
    routes: routes
});



export default router